package com.zr.task.broadcast;

import android.content.BroadcastReceiver;
import android.content.Context;
import android.content.Intent;

import com.zh.baselibrary.constant.BaseConstant;
import com.zh.baselibrary.constant.ExtraName;
import com.zh.baselibrary.model.TaskModel;
import com.zh.baselibrary.netutils.BaseResp;
import com.zh.baselibrary.rxjava.RxSubscribe;
import com.zh.baselibrary.utils.JsonUtils;
import com.zh.baselibrary.utils.LogUtils;
import com.zh.baselibrary.utils.PhoneUtil;
import com.zh.baselibrary.utils.ShareManager;
import com.zh.baselibrary.views.ToastView;
import com.zh.model.task.home.CommitBean;
import com.zh.model.task.home.RemoteOpenResVO;
import com.zr.andealib.util.HardEvent;
import com.zr.andealib.util.LockUtil;
import com.zr.andealib.util.constant.AndeaConstant;
import com.zr.andealib.util.frequency.HighFrequencyCheckUtil;
import com.zr.task.adapter.HomeCabinetAdapter;
import com.zr.task.utils.EquipmentTypeUtils;
import com.zr.task.websocket.AppResponseDispatcher;

import org.greenrobot.eventbus.EventBus;
import org.greenrobot.eventbus.Subscribe;
import org.greenrobot.eventbus.ThreadMode;

import java.util.Timer;
import java.util.TimerTask;

import io.reactivex.Observable;
import io.reactivex.android.schedulers.AndroidSchedulers;
import io.reactivex.schedulers.Schedulers;

/**
 * @author EnzoChan
 * @create 2019/8/26
 * @desc:
 */
public class RemoteBroatCast extends BroadcastReceiver {


    @Override
    public void onReceive(Context context, Intent intent) {

       int cabinetNum = intent.getIntExtra(ExtraName.KEY_TRAN_DATA, -1);
        int  teacherId = intent.getIntExtra(ExtraName.KEY_DATA, -1);
        if (teacherId == -1 || cabinetNum == -1) {
            return;
        }
        RemoteOpenResVO  mBean = new RemoteOpenResVO();
        mBean.setTeacherId(teacherId);
        mBean.setCabinetNum(cabinetNum);
        mBean.setEquipmentCode(PhoneUtil.getUUID(context));
        EventBus.getDefault().post(new HardEvent(mBean,AndeaConstant.CALL_REMOTE_OPEN));


    }

}
